﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pechovic.CommandLine;

namespace Example1 {

    class Program {

        private static ExampleParams consoleParameters;

        static void Main(string[] args) {
            try {
                
                ConsoleHelper.HandleDebugMode(ref args);

                ConsoleHelper.IsHelpRequest(args);

                consoleParameters = new ExampleParams(typeof(ExampleException));
                consoleParameters.Fill(args);
                Program p = new Program();
                p.Run();
            } catch (Exception ex) {
                ConsoleHelper.WriteExceptionText(ex.ToString());
                Console.WriteLine();
                ConsoleHelper.PrintHelp(consoleParameters.CreateHelpText());
            }
        }

        private void Run() {
            Output.WriteGreenLine("The first parameter is: {0}", consoleParameters.FirstParam);
            Output.WriteGreenLine("The second parameter is: {0}", consoleParameters.SecondParam);
            Output.WriteGreenLine("The last parameter is: {0}", consoleParameters.LastOptionalParam);
        }

    }

}

